﻿@{
    ViewBag.Title = "编辑语音回复";
}
@model DTcms.Model.weixin_request_rule
<form id="form1" class="layui-form" url="SoundSave?action=@ViewBag.action&id=@ViewBag.id">
    @Html.AntiForgeryToken()
    <!--导航栏-->
    <div class="pageheader">
        <div class="page-bar">
            <ul class="page-breadcrumb">
                <li><a href="javascript:history.back(-1);" class="back"><i class="fa fa-mail-reply-all"></i> 返回列表页</a></li>
                <li><a href="javascript:;"><i class="iconfont icon-home1"></i> 首页</a> </li>
                <li><a href="javascript:;">应用管理</a> </li>
                <li><a href="javascript:;">微信管理</a> </li>
                <li><a href="javascript:;">编辑语音回复</a> </li>
            </ul>
        </div>
    </div>
    <!--/导航栏-->
    <!--内容-->
    <div class="layui-fluid">
        <div class="layui-tab layui-tab-card">
            <ul class="layui-tab-title" id="floatHead">
                <li class="layui-this">编辑语音回复</li>
            </ul>
            <div class="layui-tab-content">
                <div class="layui-tab-item layui-show">
                    <div class="layui-form-item">
                        <label class="layui-form-label">公众账户</label>
                        <div class="layui-input-block">
                            <select class="select" name="account_id" url="/webapi/weixinJson" selectValue="@Model.account_id" promtion="请选择公众账户" datatype="*" errormsg="请选择公众账户！" sucmsg=" "><option value="">请选择公众账户...</option></select>
                            <span class="Validform_checktip">*当前的公众账户，可以切换。</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">排序数字</label>
                        <div class="layui-input-block">
                            @Html.TextBox("sort_id", Model.sort_id, new { @class = "input small", datatype = "n", sucmsg = " " })
                            <span class="Validform_checktip">*数字，越小越向前</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">关键词类型</label>
                        <div class="layui-input-block">
                            @Html.RadioButton("is_like_query", 0, Model.is_like_query == 0, new { title = "完全匹配" })
                            @Html.RadioButton("is_like_query", 1, Model.is_like_query == 1, new { title = "包含匹配" })
                            <span class="Validform_checktip">*包含匹配，当文本包含本关键词时触发</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">搜索关键词</label>
                        <div class="layui-input-block">
                            @Html.TextBox("keywords", Model.keywords, new { @class = "input normal ", datatype = "*1-1000", sucmsg = " ", nullmsg = "请填写关键词，多个关键词请用|格开：例如: 美丽|漂亮|好看" })
                            <span class="Validform_checktip">*多个关键词请用|格开：例如: 美丽|漂亮|好看</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">语音标题</label>
                        <div class="layui-input-block">
                            @Html.TextBox("txtTitle", Model.contents != null ? Model.contents[0].title : "", new { @class = "input normal", datatype = "*0-255", sucmsg = " " })
                            <span class="Validform_checktip">*最多30个字符</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">预览缩略图</label>
                        <div class="layui-input-block">
                            @Html.TextBox("txtImgUrl", Model.contents != null ? Model.contents[0].img_url : "", new { @class = "input normal upload-path", datatype = "*1-255" })
                            <div class="upload-box choose-pick"><a href="javascript:;" class="webuploader-pick" title="图片空间">选择图片</a></div>
                            <div class="upload-box upload-img"></div>
                            <span class="Validform_checktip">*必填选项，只能通过本地上传！</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">语音链接</label>
                        <div class="layui-input-block">
                            @Html.TextBox("txtMediaUrl", Model.contents != null ? Model.contents[0].media_url : "", new { @class = "input normal upload-path", datatype = "*1-500", sucmsg = " " })
                            <div class="upload-box choose-pick"><a href="javascript:;" class="webuploader-pick" title="文件空间">选择文件</a></div>
                            <div class="upload-box upload-video"></div>
                            <span class="Validform_checktip">*MP3格式，填写链接或本地上传！</span>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">语音描述</label>
                        <div class="layui-input-block">
                            @Html.TextArea("txtContent", Model.contents != null ? Model.contents[0].content : "", new { @class = "input", style = "width:100%;height:200px;", datatype = "*0-1000", sucmsg = " " })
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--/内容-->
    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-wrap">
            <button class="layui-btn icon-btn" id="btnSubmit"><i class="layui-icon layui-icon-ok"></i>提交保存</button>
            <input name="btnReturn" type="button" value="返回上一页" class="layui-btn layui-btn-warm" onclick="javascript: history.back(-1);" />
        </div>
    </div>
    <!--/工具栏-->
</form>
@section Scripts{
    <script type="text/javascript" src="/scripts/libs/js/uploader.js"></script>
    <script type="text/javascript">
        layui.use(['validform', 'element', 'jqueryform', 'cascadeSelect', 'fileChoose'], function () {
            var cascadeSelect = layui.cascadeSelect, fileChoose = layui.fileChoose;
            cascadeSelect.init('account_id', false);

            $('.choose-pick').click(function () {
                var obj = $(this);
                fileChoose.open({
                    fileUrl: '',
                    listUrl: '/admin_ajax/files',
                    num: 1,
                    dialog: {
                        offset: '60px'
                    },
                    onChoose: function (res) {
                        if (res[0].type != "file") {
                            layer.msg('我只让你选择图片格式的文件', { icon: 2, time: 2000 }, function () { });
                            return;
                        }
                        obj.siblings(".upload-path").val(res[0].url);
                        obj.siblings(".layer-photos").show().find("img").attr("src", res[0].url);
                    }
                });
            });
            //初始化表单验证
            $("#form1").initValidform('#btnSubmit', 1);

            //初始化上传控件
            $(".upload-img").InitUploader({ sendurl: "/upload_ajax/action", swf: "/scripts/libs/module/uploader/uploader.swf" });
            $(".upload-video").InitUploader({ sendurl: "/upload_ajax/action", swf: "/scripts/libs/module/uploader/uploader.swf", type: 2, chunked: true });
        });
    </script>
}